Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multibyte character counting in processed #812

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

BrettMayson
Copy link
Owner

@BrettMayson BrettMayson commented Oct 22, 2024

Possibly fix #749

Fixed the test for format args, might be other places in the code that need fixing, but this will fix position mappings

@BrettMayson BrettMayson marked this pull request as ready for review October 22, 2024 07:00
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.2%. Comparing base (d23d6e6) to head (cf76204).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
libs/config/src/analyze/chumsky.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
libs/config/src/analyze/lints/c01_invalid_value.rs 75.8% <100.0%> (ø)
...ibs/config/src/analyze/lints/c07_expected_array.rs 74.8% <100.0%> (ø)
.../config/src/analyze/lints/c08_missing_semicolon.rs 59.4% <100.0%> (ø)
...nfig/src/analyze/lints/c10_class_missing_braces.rs 65.6% <100.0%> (ø)
libs/sqf/src/analyze/lints/s05_if_assign.rs 73.7% <100.0%> (ø)
libs/sqf/src/parser/lexer.rs 82.1% <ø> (ø)
libs/workspace/src/reporting/processed.rs 91.1% <100.0%> (+0.3%) ⬆️
libs/config/src/analyze/chumsky.rs 0.0% <0.0%> (ø)

... and 1 file with indirect coverage changes

@PabstMirror
Copy link
Collaborator

"🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭";
private _workingArms = if (alive player) then { 2 } else { 0 };

still crashes with

Compiling SQF [00:00:00] █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      17/504
ERROR panicked at libs\sqf\src\analyze\lints\s05_if_assign.rs:205:43:
byte index 88 is not a char boundary; it is inside '🌭' (bytes 85..89) of `"🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭
🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭🌭";
private _workingArms = if (alive player) then { 2 } else { 0 };
`

but it's still an improvement if it's handling single Unicode correctly

@BrettMayson
Copy link
Owner Author

let haystack = &processed.as_str()[self.rhs.1.end..];

That's going to be the issue within just that lint, I can rewrite it

@BrettMayson
Copy link
Owner Author

That's fixed now with a test, every usage of .as_str()[..] is replaced with extract()

@BrettMayson BrettMayson merged commit 5cd4feb into main Oct 22, 2024
34 of 37 checks passed
@BrettMayson BrettMayson deleted the multibyte_char_mappings branch October 22, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqf: unicode problems
2 participants